/*
 * Taras Boichenko, Kiev 2012
 * NeighbouringNumbers
 * Program to find Neighbouring Numbers in array
 */
 import java.util.*;
                public class NeighbouringNumbers {
	               public static void main(String[] arg)
	       {
		         Scanner in = new Scanner (System.in);
			
		         System.out.print ("Write number of elements in array:");
		              int array_Elements = in.nextInt();
		              int[] array_Number = new int[array_Elements];
		     if(array_Number.length < 2){
			     System.out.println ("It must  be more than one elemant in array.");
			                return;
		}
			     System.out.println ("Fill array");
		
		                     for (int count_element = 0; count_element < array_Number.length; count_element++) 
		{
			     System.out.println ("Array[" + count_element + "]:");
			         int Elements_value = in.nextInt();
			              array_Number[count_element] = Elements_value;
		}
				
				     int firstCompare = Math.abs(array_Number[0] - array_Number[1]);
		             int smallestdistanceindex = 0;
		                     for (int Index_in_array = 0; Index_in_array < array_Number.length - 1; Index_in_array++)
		{
			  if (firstCompare > (Math.abs(array_Number[Index_in_array] - array_Number[Index_in_array + 1])) ){
				      firstCompare = (Math.abs(array_Number[Index_in_array] - array_Number[Index_in_array + 1]));
				      smallestdistanceindex = Index_in_array;
			}
		}
		        System.out.println ("Index:" + smallestdistanceindex);
	}
}
		
		
	
	